Skip to main content

Create New Record with Data Action


Context

Collections are the foundation of your app's data in LiveCode Create. With the Create New Record with Data action, you can create a record and set specific field values upfront, saving you time and reducing manual updates later.

This action is particularly useful when:

  • Pre-filling form data programmatically.
  • Creating new entries in a Collection with defined field values.
  • Automatically adding new records in workflows, such as after a user submits a form or triggers an event.

Properties

When configuring the Create New Record with Data action, you will set the following properties:

PropertyDescription
Collection NameThe target Collection where the new record will be created.
Go to Created RecordWhether to automatically navigate to the newly created record (Boolean).
Collection FieldsThe specific fields in the Collection where you want to set values.
  • Collection Name: Selected from a dropdown of all available Collections.
  • Go to Created Record: A simple checkbox option.
  • Collection Fields: Dynamically presented based on the fields defined in the selected Collection.

Example

Imagine you have a Collection called "Tasks" with the following fields:

  • taskName (Text)
  • dueDate (Date)
  • completed (Boolean)

You can configure the action to create a new record in the "Tasks" Collection, providing values for these fields.

Steps to Configure

  1. Select the Action: Drag the Create New Record with Data action into the Workflow Editor.
  2. Set Properties:
    • Collection Name: Tasks
    • Go to Created Record: Checked
    • Fields:
      • taskName: "New Task"
      • dueDate: "2024-06-01"
      • completed: false

Code Generated

When you configure the action, the following LiveCode Script is automatically generated:

Create New Record with Data
datastoreCreateNewRecordInCollectionWithData "Tasks",   
{ "taskName": "New Task", "dueDate": "2024-06-01", "completed": false },
true

Visual Example

Here’s what it might look like when configuring the action:

Create New Record with Data Configuration


For further learning:

Thank you for your feedback!

Was this page helpful?